package Sj01.factory;

import Sj01.entity.Operation;
import Sj01.service.Add;
import Sj01.service.Div;
import Sj01.service.Mul;
import Sj01.service.Sub;

public class OperationFactory {
    public static Operation creatOperation(String oper){
        Operation operation = null;
        switch (oper){
            case "+":
                operation = new Add();
                break;
            case "-":
                operation = new Sub();
                break;
            case "*":
                operation = new Mul();
                break;
            case "/":
                operation = new Div();
            default:
                System.out.println("运算错误");
        }
        return operation;
    }
}
